<template>
	<hyb-page title="订单中心"  :leading="false">
		<!-- 请开始您的开发 ~ -->
		<template v-slot:body>
			<view>
			
				<!-- #ifdef MP -->
				<official-account v-if="!$store.state.userinfo.openid" ></official-account>
				<!-- #endif -->
				<view 
					class="gui-border-radius-large gui-margin-top-middle gui-bg-white gui-margin-x-middle">

					<navigator   url="/hyb_o2o/inner/pages/fabu/list?tag=yh">
						<view class="gui-list">
							<view class="gui-padding-middle gui-list-items gui-border-b">
								<text class="gui-list-icon gui-icons " style="font-size: 40rpx;color: #97CAF1;">&#xe638;</text>
								<view class="gui-list-body">
									<view class="gui-list-title">
										<view class="gui-flex gui-align-items-center">
											<text class="gui-list-title-text">服务订单</text>
										</view>

									</view>
								</view>
								
								<text class="gui-list-arrow-right gui-icons gui-color-gray">&#xe601;</text>
							</view>
						</view>
					</navigator>
					<navigator   url="/hyb_o2o/subpagesA/pages/order/order">
						<view class="gui-list  gui-border-b">
							<view class="gui-padding-middle gui-list-items">
								<text class="gui-list-icon gui-icons " style="font-size: 40rpx;color: #97CAF1;">&#xe624;</text>
								<view class="gui-list-body">
									<view class="gui-list-title">
										<view class="gui-flex gui-align-items-center">
											<text class="gui-list-title-text">商品订单</text>
										</view>

									</view>
								</view>
								<text class="gui-list-arrow-right gui-icons gui-color-gray">&#xe601;</text>
							</view>
						</view>
					</navigator>
					<navigator   url="/hyb_o2o/subpagesA/pages/order/order">
						<view class="gui-list  gui-border-b">
							<view class="gui-padding-middle gui-list-items">
								<text class="gui-list-icon gui-icons " style="font-size: 40rpx;color: #97CAF1;">&#xe624;</text>
								<view class="gui-list-body">
									<view class="gui-list-title">
										<view class="gui-flex gui-align-items-center">
											<text class="gui-list-title-text">师傅接单</text>
										</view>

									</view>
								</view>
								<text class="gui-list-arrow-right gui-icons gui-color-gray">&#xe601;</text>
							</view>
						</view>
					</navigator>
					<navigator   url="/hyb_o2o/subpagesA/pages/order/order">
						<view class="gui-list  gui-border-b">
							<view class="gui-padding-middle gui-list-items">
								<text class="gui-list-icon gui-icons " style="font-size: 40rpx;color: #97CAF1;">&#xe624;</text>
								<view class="gui-list-body">
									<view class="gui-list-title">
										<view class="gui-flex gui-align-items-center">
											<text class="gui-list-title-text">充值记录</text>
										</view>

									</view>
								</view>
								<text class="gui-list-arrow-right gui-icons gui-color-gray">&#xe601;</text>
							</view>
						</view>
					</navigator>
                  <!--  <navigator :url="'/hyb_o2o/fenxiao/qrcode?id=' + info.f_id + '&yg_id=' + info.y_id">
                    	<view class="gui-list  gui-border-b">
                    		<view class="gui-padding-middle gui-list-items">
								<text class="gui-list-icon gui-icons " style="font-size: 35rpx;color: #97CAF1;">&#xe606;</text>
                    			<view class="gui-list-body">
                    				<view class="gui-list-title">
                    					<view class="gui-flex gui-align-items-center">
                    						<text class="gui-list-title-text">会员购买</text>
                    					</view>
                    
                    				</view>
                    			</view>
                    			<text class="gui-list-arrow-right gui-icons gui-color-gray">&#xe601;</text>
                    		</view>
                    	</view>
                    </navigator>
                    -->

				</view>

				
			</view>
	<view  class="gui-ic-banquan gui-padding" v-if="base.uniacid == 15">
		<text class="gui-ic-banquan">包小筑 · 建筑业包工包料竞价平台</text>
	</view>
			<view style="height: 1rpx;"></view>
			<hyb-bzj ref="bzj"></hyb-bzj>
			
		</template>
	</hyb-page>

</template>
<script>
	export default {
		data() {
			return {
				info: {},
				code: "",
				time: 0,
			}
		},
		computed: {
			base: () => {
				return uni.storage.get("base");
			}
		},

		async onShow() {
			let location = await uni.location.getLocation();
			uni.gPost("yuangong/info", {
				location: location,
				is_rz: 1
			}).then((info) => {
				
			})
		},

		methods: {

			bzj() {
				uni.showActionSheet({
					itemList: ["充值", "提现"],
					success: (res) => {
						if (res.tapIndex == 1) {
							uni.gPost("fadan/counts").then((counts) => {
								if (counts > 0) {
									uni.showModal({
										title: "提现",
										content: "您有订单在竞价中、服务中、待验收状态，不允许提现「接单保证金」，请完成订单，再来提现",
										confirmText: "查看订单",
										success: (res) => {
											if (res.confirm) {
												uni.navigateTo({
													url: "/hyb_o2o/inner/pages/fabu/list?tag=yg&t_y_id=" +
														this.info.y_id
												})
											}
										}
									})
								} else {
									// uni.navigateTo({
									// 	url: "/hyb_o2o/tixian/tixian?tag=yg_bzj"
									// })
								}
							})


						} else if (res.tapIndex == 0) {
							this.recharge();
						}
					}
				})
			},

			comfirm() {
				if (this.code.length != 4) {
					uni.showToast({
						title: "验证码错误!",
						icon: 'none'
					})
				} else {
					uni.gPost("yuangong/remove").then(() => {
						this.$refs.popup.close();
						uni.redirectTo({
							url: this.$store.state.base.hyzx_luj
						})
					})
				}
			},

			setting() {
				uni.showActionSheet({
					itemList: ["注销帐户"],
					success: (res) => {
						if (res.tapIndex == 0) {
							uni.showModal({
								title: "注销提醒",
								content: "注销后将消除所信信息，是否确认操作1?",
								success: (res) => {
									if (res.confirm) {
										if (this.$store.state.base.dx_config) {
											uni.gPost("yuangong/zx/sms").then(() => {
												this.time = 120;
												this.timer();
												this.$refs.popup.open();
											})
										} else {
											uni.gPost("yuangong/remove").then(() => {
												this.$refs.popup.close();
												uni.redirectTo({
													url: this.$store.state.base
														.hyzx_luj
												})
											})
										}

									}
								}
							})
						}
					}
				})
			},


			timer() {
				if (this.time > 0) {
					this.time--;
					setTimeout(() => {
						this.timer();
					}, 1000)
				}
			},

			recharge() {
				this.$refs.bzj.open();
			},
			ti_xian(f_id) {

				if (f_id) {
					// uni.navigateTo({
					// 	url: "/hyb_o2o/tixian/tixian?tag=fx&id=" + f_id
					// })
				} else {
					// uni.navigateTo({
					// 	url: "/hyb_o2o/tixian/tixian?tag=yg"
					// })
				}
				// return;
				// uni.showModal({
				// 	title: "提现",
				// 	content: "确定提现保证金？",
				// 	success: (res1) => {
				// 		if (res1.confirm) {
				// 			uni.gPost("yuangong/bzj_st", {
				// 				y_id: this.info.y_id,
				// 				baozhengjin: this.info.baozhengjin
				// 			}).then((info) => {
				// 				info.y_endtime = info.y_endtime.substring(0, 10);
				// 				this.info = info;
				// 			})
				// 		}
				// 	}
				// })
			},

			jdChange(e) {
				uni.gPost("yuangong/save", {
					y_id: this.info.y_id,
					jd_tongzhi: e.detail.value ? 1 : 0
				}).then((res) => {
					uni.gJs.msg("操作成功!")
				})
			},
			to(url) {
				uni.gJs.navigate(url);
			},
			yg_huiyuan() {
				// uni.navigateTo({
				// 	url: "/hyb_o2o/xqdt/xqdt"
				// })
			},
			toInfo() {
				uni.gJs.navigate("/hyb_o2o/user/info/info");
			},

		}
	}
</script>
<style scoped>
	.gui-icons {
		font-size: 50rpx;
	}

	.gui-list-title-text {
		font-size: 32rpx;
	}
	.gui-ic-banquan {
		width: 100%;
		text-align: center;
		margin-top: 10rpx;
		font-size: 25rpx;
		color:#b3b3b3;
	}

	.gui-button {
		padding: 0 40rpx !important;
		height: 60rpx;
		padding: 0;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.gui-ic-image {
		width: 68rpx;
		height: 68rpx;
		margin-bottom: 10rpx;
	}

	.avatar-wrapper {
		background: none;
		padding: 0;
		border: none;
	}

	.avatar-wrapper::after {
		border: none;
	}
</style>
